//
//  CommonTableViewCell.m
//  TheVideoClip
//
//  Created by 北斗君合MacMini on 2018/3/29.
//  Copyright © 2018年 北斗君合MacMini. All rights reserved.
//

#import "CommonTableViewCell.h"

@interface CommonTableViewCell ()

@property (nonatomic, strong) UIView *lineView;

@end

@implementation CommonTableViewCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        if (!_lineView) {
            _lineView = [CreateControlTool getViewWithBackgroundColor:[UIColor lightGrayColor]];
            [self.contentView addSubview:_lineView];
            [_lineView mas_makeConstraints:^(MASConstraintMaker *make) {
                make.left.right.bottom.equalTo(self.contentView);
                make.height.mas_equalTo(lineHeight);
            }];
        }
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)setLineViewLeftMargin:(CGFloat)lineViewLeftMargin {
    _lineViewLeftMargin = lineViewLeftMargin;
    [_lineView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView).offset(lineViewLeftMargin);
    }];
}

- (void)setLineViewRightMargin:(CGFloat)lineViewRightMargin {
    _lineViewRightMargin = lineViewRightMargin;
    [_lineView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.contentView).offset(-lineViewRightMargin);
    }];
}

- (void)setHideLine:(BOOL)hideLine {
    _hideLine = hideLine;
    self.lineView.hidden = hideLine;
}

@end
